﻿// <copyright file="IFilter.cs" company="Signal Processing Lab, Wuhan University">
// Copyright (c) 2009-2010 All Right Reserved
// </copyright>
// <author>Xinping Deng</author>
// <email>dentoby@gmail.com</email>
// <date>2010-4</date>
// <summary>This is part of Image.NET project.</summary>

namespace SPLWHU.Core.Raster
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;

    /// <summary>
    /// The kinds of results after applying a <see cref="IFilter"/>.
    /// </summary>
    public enum FilterEffect
    {
        /// <summary>
        /// No display. This is usually creates temporary results for other filters.
        /// </summary>
        NoDisplay,

        /// <summary>
        /// Changes the input data.
        /// </summary>
        InPlace,

        /// <summary>
        /// Creates new raster data.
        /// </summary>
        NewRaster,

        /// <summary>
        /// Creates new vector data.
        /// </summary>
        NewVector
    }

    /// <summary>
    /// The filter interface.
    /// </summary>
    public interface IFilter
    {
        /// <summary>
        /// Gets the name of this filter.
        /// </summary>
        /// <value>The name of this filter.</value>
        string Name { get; }

        /// <summary>
        /// Gets a value indicating whether an interaction is needed to set parameters.
        /// </summary>
        /// <value>
        /// <c>true</c> if parameters are needed; otherwise, <c>false</c>.
        /// </value>
        bool IsConfigurable { get; }

        /// <summary>
        /// Gets a value indicating whether creates a menu item or not.
        /// </summary>
        /// <value><c>true</c> if create a menu item; otherwise, <c>false</c>.</value>
        bool ShowMenuItem { get; }

        /// <summary>
        /// Gets or sets the short key.
        /// </summary>
        /// <value>The short key.</value>
        int ShortKey { get; set; }

        /// <summary>
        /// Gets the effect <see cref="FilterEffect"/> of this filter.
        /// </summary>
        /// <value>The filter effect.</value>
        FilterEffect Effect { get; }

        /// <summary>
        /// Gets the parameters.
        /// </summary>
        /// <returns>The parameters stored in a <see cref="TagCollection"/>.</returns>
        TagCollection GetParameters();

        /// <summary>
        /// Updates the parameters.
        /// </summary>
        /// <param name="paras">The parameters stored in a <see cref="TagCollection"/>.</param>
        void UpdateParameters(TagCollection paras);

        /// <summary>
        /// Applies the effect to the specified image.
        /// </summary>
        /// <typeparam name="T">The data type of image data.</typeparam>
        /// <param name="imageHeader">The image header.</param>
        /// <param name="bands">The bands of the image.</param>
        void Apply<T>(TagCollection imageHeader, params Matrix<T>[] bands);

        /// <summary>
        /// Gets the filter results.
        /// </summary>
        /// <returns>The result after applying the filter. It is different depending on the effect <see cref="FilterEffect"/>.</returns>
        object GetResults();
    }
}
